<?php

namespace app\api\model;


use think\Model;

/**
 *   圈子模型
 *
 * Class Circle
 * @package app\api\model
 */
class Circle extends Model
{
    /**
     * 获取到所有圈子
     *
     * @return bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getCircle()
    {
        $where = [];
        return $this->where($where)
            ->select();
    }

    /**
     * 获取圈子简介
     *
     * @param $id
     * @return array|bool|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */

    public function detail($id)
    {
        $circle = $this->where('id', $id)->find();
        return $circle;
    }

    /**
     * 获取搜索圈子名
     *
     * @param $data
     * @return bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */

    public function searchcir($data)
    {
        $circle = $this->where('name|content', 'like', "%" . $data . "%")->select();
        return $circle;
    }
}